package com.hualan.sfzy.service.impl.permission;

import com.hualan.sfzy.mapper.permission.UserRoleMapper;
import com.hualan.sfzy.model.entity.UserRole;
import com.hualan.sfzy.service.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;
import java.util.Map;

@Service
public class UserRoleServiceImpl implements BaseService<UserRole> {
    @Autowired
    private UserRoleMapper mapper;
    @Override
    public int add(UserRole entity) {
        return mapper.insert( entity);
    }

    /**
     * 没有修改操作
     * @param entity
     * @return
     */
    @Override
    public int edit(UserRole entity) {
        return 0;
    }


    @Override
    public int remove(Integer id) {
        return mapper.delete( id);
    }

    /**
     * 没有批量删除操作
    */
    public int removeBatch(Integer[] ids) {
        return 0;
    }

    @Override
    public List<UserRole> find() {
        return mapper.select( null);
    }

    @Override
    public Map<String, Object> findPage(Integer pageNum, Integer pageSize, UserRole entity) {
        return Collections.emptyMap();
    }

    @Override
    public UserRole findById(Integer id) {
        return mapper.findByUserId(id);
    }

    public UserRole findByUserId(Integer id) {
        return mapper.findByUserId( id);
    }


}
